package com.gosophia.conference.action.confPrepare;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.gosophia.conferenceManagement.confPreparation.dto.ParticipatingNameListDTO;
import com.gosophia.conferenceManagement.confPreparation.ws.ConfPreparationWebService;
import com.gosophia.oa.action.JudgeCurrentUndertaker;
import com.opensymphony.xwork2.ActionSupport;
/**
 * 查看参会名单
 * @author wangxinbing
 * @since  2011-3-26
 *  Copyright (c) 2010 Gosophia corporation All Rights Reserved
 */
@Component("GetParticipatingNameListAction")
@Scope("prototype")
public class GetParticipatingNameListAction extends ActionSupport {
	@Autowired
	private ConfPreparationWebService confPreparationWebService;
	@Autowired
	private JudgeCurrentUndertaker judgeCurrentUndertaker;
	private Long jobId;
	
	private List<ParticipatingNameListDTO> particiLists;
	
    private List<ParticipatingNameListDTO> feedBackLists;
	
	private int totalCount = 0;
	
	private int attendCount = 0;
	
	private int notAttendCount = 0;
	
	private int notFeedBackCount = 0;
	
	private int particiSize = 0;
	
	public String execute() throws Exception{
		//判断是否匹配,如果不匹配转到异常页面
        judgeCurrentUndertaker.judgeOperationAuthority(jobId);
		particiLists = confPreparationWebService.findParticipatingNameListsByJobId(jobId);
		particiSize = particiLists.size();
		feedBackLists = confPreparationWebService.findNotificationFeedbackListsByJobId(jobId);
		totalCount = feedBackLists.size();
		for(ParticipatingNameListDTO feedBack :feedBackLists){
			if("是".equals(feedBack.getIfAttend())){
				attendCount++;
			}else if("否".equals(feedBack.getIfAttend())){
				notAttendCount++;
			}else{
				notFeedBackCount++;
				feedBack.setIfAttend("-");
			}
		}
		return SUCCESS;
	}
	public Long getJobId() {
		return jobId;
	}
	public void setJobId(Long jobId) {
		this.jobId = jobId;
	}
	public List<ParticipatingNameListDTO> getParticiLists() {
		return particiLists;
	}
	public void setParticiLists(List<ParticipatingNameListDTO> particiLists) {
		this.particiLists = particiLists;
	}
	public List<ParticipatingNameListDTO> getFeedBackLists() {
		return feedBackLists;
	}
	public void setFeedBackLists(List<ParticipatingNameListDTO> feedBackLists) {
		this.feedBackLists = feedBackLists;
	}
	public int getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}
	public int getAttendCount() {
		return attendCount;
	}
	public void setAttendCount(int attendCount) {
		this.attendCount = attendCount;
	}
	public int getNotAttendCount() {
		return notAttendCount;
	}
	public void setNotAttendCount(int notAttendCount) {
		this.notAttendCount = notAttendCount;
	}
	public int getNotFeedBackCount() {
		return notFeedBackCount;
	}
	public void setNotFeedBackCount(int notFeedBackCount) {
		this.notFeedBackCount = notFeedBackCount;
	}
	public int getParticiSize() {
		return particiSize;
	}
	public void setParticiSize(int particiSize) {
		this.particiSize = particiSize;
	}
	
	
}
